require('../../assets/css/index.js')
require('../../assets/fonts/font/iconfont.css')
require('../../assets/lib/swiper/swiper-bundle.css')
let Swiper = require('../../assets/lib/swiper/swiper-bundle.js')
require('../../utils/local.js')
let https = require('../../utils/https.js')

// 引入公共js
let dom = require('../../utils/dom.js')
const local = require('../../utils/local.js')
//引入当前页面的less文件
require('./courseDetails.less')
// 当前页面js
dom.isLogin();

dom.ready(function () {
    // 方式一a标签传参
    let id = window.location.search.slice(1);
    

    // f方式三获取id
    // let  id=local.get('course');

    // 获取接口课程数据详情
    if (id) {
        https.get('/api/train/courseDetail', { id: id }, function (res) {
            if (res.errno == 0) {
                console.log(res);
                dom.getEle(".playImg").src = https.hostUrl + res.data.imgurl;
                // console.log(https.hostUrl + res.data.imgurl);

                dom.getEle("#title").innerHTML = res.data.name;
                dom.getEle(".desc").innerHTML = res.data.desc;

                // 保存播放页面数据到本地
                local.set('fragments', res.data.fragments);
                console.log(res.data.fragments);
            }
        })
    }
    dom.getEle(".return").addEventListener("click", function () {
        window.history.go(-1);
      })
})